#!/bin/bash
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
mkdir /home/rpm/;
cd /home/rpm/;
# ftp -i -n 10.37.128.52 <<EOF
# user admin 123@456.com
# binary
# bin
# get zabbix-agent-4.0.3-1.el7.x86_64.rpm
# quit
# bye
# EOF
curl http://10.37.128.50:8080/zabbix-agent-4.0.3-1.el7.x86_64.rpm -o zabbix-agent-4.0.3-1.el7.x86_64.rpm
rpm -ivh zabbix-agent-4.0.3-1.el7.x86_64.rpm
systemctl enable zabbix-agent
sed -i 's/Server=127.0.0.1/Server=10.37.128.50/g' /etc/zabbix/zabbix_agentd.conf
sed -i 's/ServerActive=127.0.0.1/ServerActive=10.37.128.50/g' /etc/zabbix/zabbix_agentd.conf
HOSTNAME=`hostname`
sed -i 's/Hostname=Zabbix server/Hostname='$HOSTNAME'/g' /etc/zabbix/zabbix_agentd.conf
#sed -i 's/LogFile=\/tmp\/zabbix_agentd.log/LogFile=\/var\/log\/zabbix\/zabbix_agentd.log/g' /etc/zabbix/zabbix_agentd.conf
sed -i '/# HostMetadataItem=/a\HostMetadataItem=system.uname' /etc/zabbix/zabbix_agentd.conf
systemctl restart zabbix-agent
echo 安装成功